#ifndef SGESTRING_H
#define SGESTRING_H

#include "sgeTypes.h"

namespace sge {

class SgeString {
public:
    static void split(const String& str, const String& split, StringList& tokens) {
        int firstSplit = str.find(split);
        if (firstSplit == String::npos) {
            tokens.push_back(str);
        } else {
            tokens.push_back(str.substr(0,firstSplit));
            SgeString::split(str.substr(firstSplit+1),split,tokens);
        }
    }
    
    static String replace(const String& str, const String& from , const String& to) {
        String ret, comp;
        for (int i = 0; i < str.size(); ++i) {
            comp = str.substr(i,1);
            if (comp == from)
                ret.append(to);
            else
                ret.append(comp);
        }
        return ret;
    }
};

}

#endif
